home *** CD-ROM | disk | FTP | other *** search
Wrap
/* ** $VER: CalcDl.thor 1.2 (18.10.96) ** by Eirik Nicolai Synnes ** ** This script will calculate an estimate of the time needed to download ** files selected in Thor and present the results in a requester. In ** order to do this the files will have to be present in Thor's file ** database. It can be run either in the Startup Window or from inside a ** system. ** ** Change the cpsrate variable below to whatever your modem is capable of. ** */ cpsrate = 3100 /* ** Don't edit anything below here */ options results /* Find Thor and BBSREAD ARexx ports' */ p=address()||' '||show('P',,);if pos(' THOR.',p)>0 then thorport=word(substr(p,pos(' THOR.',p)),1);else do;say 'No THOR port found!';exit(0);end if ~show('p', 'BBSREAD') then do; address command; "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"; "WaitForPort BBSREAD"; end totsize = 0; numfiles = 0; notfound = 0 address(thorport) 'CURRENTSYSTEM STEM 'curbbs if rc > 1 then do 'REQUESTNOTIFY "CURRENTSYSTEM: 'THOR.LASTERROR'" "Ok"' exit(0) end address(bbsread) 'GETBBSDATA BBSNAME "'curbbs.BBSNAME'" STEM 'bbsdata if rc ~= 0 then do address(thorport) 'REQUESTNOTIFY "GETBBSDATA: 'BBSREAD.LASTERROR'" "Ok"' exit(0) end if bbsdata.NUMEVENT > 0 then do event = bbsdata.FIRSTEVENT to bbsdata.LASTEVENT 'READBREVENT BBSNAME "'curbbs.BBSNAME'" EVENTNR 'event' TAGSSTEM 'evtag' DATASTEM 'evdata if rc ~= 0 then do address(thorport) 'REQUESTNOTIFY "READBREVENT: 'BBSREAD.LASTERROR'" "Ok"' exit(0) end if evdata.EVENTTYPE = 4 then do if ~bittst(evdata.FLAGS, 0) & ~bittst(evdata.FLAGS, 2) & ~bittst(evdata.FLAGS, 3) & ~bittst(evdata.FLAGS, 5) then do if evtag.DIRECTORY = 'EVTAG.DIRECTORY' then 'SEARCHBRFILE BBSNAME "'curbbs.BBSNAME'" STEM 'file' SEARCH "'evtag.FILENAME'" NAME' else do 'SEARCHBRFILE BBSNAME "'curbbs.BBSNAME'" STEM 'file' FAREANAME "'evtag.DIRECTORY'" SEARCH "'evtag.FILENAME'" NAME' end if (rc ~= 0) & (rc ~= 6) then do address(thorport) 'REQUESTNOTIFY "SEARCHBRFILE: 'BBSREAD.LASTERROR'" "Ok"' exit(0) end if (symbol('result') = 'VAR') & (result > 0) then do 'READBRFILE BBSNAME "'curbbs.BBSNAME'" FAREANAME "'file.FILEAREA.1'" FILENR 'file.FILE.1.1' TAGSSTEM 'fltag if rc ~= 0 then do address(thorport) 'REQUESTNOTIFY "READBRFILE: 'BBSREAD.LASTERROR'" "Ok"' address(bbsread) notfound = notfound + 1 end else do totsize = totsize + fltag.SIZE numfiles = numfiles + 1 end end else notfound = notfound + 1 end end drop evtag. evdata. file. end address(thorport) if totsize = 0 & notfound = 0 then do 'REQUESTNOTIFY "No active downloads on 'curbbs.BBSNAME'." "Ok"' exit(0) end if totsize > 0 then do xfertime = totsize / 8 * 9 / cpsrate xfermin = trunc(xfertime / 60) xfersec = trunc(xfertime // 60) reqbody = 'Statistics on active downloads at 'curbbs.BBSNAME':\n\n'numfiles 'files counting 'totsize' bytes ('totsize/1024'kb).\n\nTransfertime at 'cpsrate' characters per second:\nApproximately 'xfermin' minute(s) and 'xfersec' second(s).' if notfound > 0 then reqbody = reqbody'\n\n'notfound' file(s) were not found in the file database.' end else do if notfound > 0 then reqbody = 'None of the files were found in the file database.' end 'REQUESTNOTIFY "'reqbody'" "Thanks"' exit(0)